
<template>
	<view class="content">
		<view class="zaishou">
			<view class="item" v-for="(item,index) in history" @click="navigatorTo(item)" :key="index">
				<view class="i1">
					<view class="name">{{item.title}}</view>
					<view>{{item.content}}</view>
					<view style="color: #a5a5a5;">{{$u.timeFormat(item.createdAt, 'yyyy/mm/dd/ hh:MM')}}</view>
				</view>
				<view class="i2">
					<text>{{item.accountType==1?'+':'-'}}</text>
					<text>{{item.coin}}</text>
				</view>
			</view>
			<view class="uni-loadmore" v-if="load.showLoadMore">{{load.loadMoreText}}</view>
		</view>
	</view>
</template>
<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		computed: {
			...mapGetters(['userInfo', 'api','userToken']),
		},
		data() {
			return {
				history:[],//获取历史预测
				load:{
					end:false,//是否没有数据了
					page:1,
					loadMoreText: "加载中...",
					showLoadMore: false,
				},
			}
		},
		onLoad() {
			this.expertHistoryFact();
		},
		onReachBottom() {
			if (this.load.end==true) {
				this.load.loadMoreText = "没有更多数据了!"
				return;
			}
			this.load.showLoadMore = true;
			this.load.page++
			this.expertHistoryFact();
		},
		methods:{
			clickBtn(index){
				this.active=index
			},
			//预测订单
			expertHistoryFact(){
				let params={
					page:this.load.page,
				}
				uni.$u.http.post(this.api.api_v1_order_accountLog, params).then(res => {
					if(!res.data.next_page_url){
						this.load.end=true
					}
					if(res.code==200&&res.data&&res.data.data){
						this.history=this.history.concat(res.data.data)
						
					}
				})
			},
		}
		
	}
</script>

<style lang="scss" scoped>
	.red{
		color: #f04545;
	}
	.content{
		padding: 5px 10px;box-sizing: border-box;color: #fff;font-size: 14px;line-height: 30px;
		.zaishou{
			margin: 10px 0;
			.title{
				font-size: 14px;width: 100%;border-bottom: 1px solid #4b4b98;line-height: 30px;
			}
			.item{
				padding: 10px 15px;margin-bottom: 10px;background-color: #242448;display: flex;justify-content: space-between;align-items: center;
				.i1{
					.name{
						font-size: 18px;font-weight: bold;
					}
				}
				.i2{
					font-size: 20px;color: #f04545;
				}
			}
		}
		.uni-loadmore{
			text-align: center;margin: 10px;
		}
	}
</style>
